]> git.r.bdr.sh - rbdr/super-polarity/blame_incremental - Super Polarity/MainShip.cs
Moves to ActorManager arch + Actor Inherited stuff
[rbdr/super-polarity] / Super Polarity / MainShip.cs
... / ...
CommitLineData
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Content;
7using Microsoft.Xna.Framework.Graphics;
8
9namespace SuperPolarity
10{
11 class MainShip : Ship
12 {
13
14 uint Multiplier;
15 uint Lives;
16 uint Score;
17 ParticleEngine particleEngine;
18
19 public override void Initialize(ContentManager Content, Texture2D texture, Vector2 position)
20 {
21 base.Initialize(Content, texture, position);
22
23 Multiplier = 1;
24 Lives = 3;
25 Score = 0;
26
27 List<Texture2D> texturesList = new List<Texture2D>();
28 texturesList.Add(Content.Load<Texture2D>("Graphics\\circle"));
29 texturesList.Add(Content.Load<Texture2D>("Graphics\\diamond"));
30 texturesList.Add(Content.Load<Texture2D>("Graphics\\star"));
31
32 particleEngine = new ParticleEngine(texturesList, Position);
33
34 BindInput();
35 }
36
37 void BindInput()
38 {
39 InputController.Bind("moveX", HandleHorizontalMovement);
40 InputController.Bind("moveY", HandleVerticalMovement);
41 }
42
43 public void HandleHorizontalMovement(float value)
44 {
45 Acceleration.X = value * AccelerationRate;
46 }
47
48 public void HandleVerticalMovement(float value)
49 {
50 Acceleration.Y = value * AccelerationRate;
51 }
52
53 public override void Update(GameTime gameTime)
54 {
55 base.Update(gameTime);
56 particleEngine.EmitterLocation = Position;
57 particleEngine.Update();
58 }
59
60 public override void Draw(SpriteBatch spriteBatch)
61 {
62 particleEngine.Draw(spriteBatch);
63 base.Draw(spriteBatch);
64 }
65 }
66}